<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>小米图标</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .logo {
            overflow: hidden;
            position: relative;
            width: 500px;
            height: 500px;
            background-color: #ff6700;
            margin: 0 auto;
        }
        /*方法二：伪元素法*/
        
        .logo::after,
        .logo::before {
            /*float: left;*/
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 1;
            content: '';
            background: url("../media_resourcing/mi-logo.png") no-repeat center;
            transition: all 2s;
        }
        
        .logo::after {
            margin-left: -500px;
            background: url("../media_resourcing/mi-home.png") no-repeat center;
        }
        
        .logo:hover::after {
            margin-left: 0;
        }
        
        .logo:hover::before {
            margin-left: 500px;
        }
    </style>
</head>

<body>
    <div class="logo"></div>
</body>

</html>